package com.zytlifeservice.repository.find;

import com.zytlifeservice.domain.find.UserInfo;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * Created by MJS on 2017/4/22.
 */
public interface UserInfoRepository extends JpaRepository<UserInfo, Long> {
//    //支持模糊查询
//    @Query(value = "select c.user_id,c.name,c.area,c.mobile,c.user_integral,i.total_consumption,i.consume_integral from user c,user_info i  where c.user_id=i.user_id and c.name like %:name% ",nativeQuery = true)
//    public List<UserInfo> getUser(@Param("name") String name);
//
//    //查询用户总数
//    @Query(value = "select count(u) from UserInfo u")
//    public Integer userCount();
//
//    //查询用户(分页)
//    @Query(value = "select c.user_id,c.name,c.area,c.mobile,c.user_integral,i.total_consumption,i.consume_integral from user c,user_info i  where c.user_id=i.user_id LIMIT ?1,?2",nativeQuery = true)
//    public List<UserInfo> findAllUser(Integer currentPage,Integer pageSize);

    UserInfo findByUserId(long userId);
}
